<template>
    <div class="child">
      <h1>Props的Child组件</h1>
      <h1>Child的玩具:{{ toy }}</h1>
      <h1 v-if="fatherCar">父亲给的车:{{ fatherCar }}</h1>
      <button @click="toyFunction(toy)">调用父亲传来的函数</button>
    </div>
  </template>
  
  <script lang="ts" setup>
    import useChildComponent from '@/hooks/useChildComponent';
    const { toy } = useChildComponent()
    defineProps(['fatherCar','toyFunction'])
  </script>
  
  <style scoped>
    button {
    /* 增大按钮的字体大小 */
    font-size: 20px; 
    /* 增大按钮的内边距 */
    padding: 10px 20px; 
    }
  </style>